<template>
<div>
  <div>
      <el-button type="text" @click="introduction = true" icon="el-icon-s-finance" id="but1">&nbsp;收费</el-button>
      <el-drawer
          title="请确认！"
        :before-close="handleClose"
        :visible.sync="introduction"
        direction="rtl"
        custom-class="demo-drawer"
        ref="drawer">
        <div class="demo-drawer__content">
          <el-form :model="form">
            <el-form-item label="单号" :label-width="formLabelWidth">
              <el-input v-model="form.oddnum"></el-input>
            </el-form-item>
            <el-form-item label="科室" :label-width="formLabelWidth">
              <el-input v-model="form.icu" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="接诊类型" :label-width="formLabelWidth">
              <el-input v-model="form.reception" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="医师" :label-width="formLabelWidth">
              <el-input v-model="form.doctor" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="日期" :label-width="formLabelWidth">
              <el-input v-model="form.date" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="挂号员" :label-width="formLabelWidth">
              <el-input v-model="form.operator" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="金额" :label-width="formLabelWidth">
              <el-input v-model="money" autocomplete="off" disabled></el-input>
            </el-form-item>
          </el-form>
          <div class="demo-drawer__footer">
            <el-button @click="cancelForm">取 消</el-button>
            <el-button type="primary" @click="$refs.drawer.closeDrawer()" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
          </div>
        </div>
      </el-drawer>
  </div>
    <div class="topblock">
      <ul valid-v-model="form">
        <li>
          <label for="">挂号单号</label>
          <el-input v-model="form.oddnum" style="width:100%;height:40px"></el-input>
        </li>
        <li>
          <label for="">科室</label>
          <el-select v-model="form.icu" placeholder="请选择">
            <el-option
              v-for="item in options1"
              :key="item.value"
              :label="item.label"
              :value="item.value" style="width:100%;height:40px">
            </el-option>
          </el-select>
        </li>
        <li>
          <label for="">接诊类型</label>
          <el-select v-model="form.reception" placeholder="请选择">
            <el-option
              v-for="item in options2"
              :key="item.value"
              :label="item.label"
              :value="item.value" style="width:100%;height:40px">
            </el-option>
          </el-select>
        </li>
        <li>
          <label for="">接诊医生</label>
          <el-select v-model="form.doctor" placeholder="请选择">
            <el-option
              v-for="item in options3"
              :key="item.value"
              :label="item.label"
              :value="item.value" style="width:100%;height:40px">
            </el-option>
          </el-select>
        </li>
        <li>
          <label for="">挂号费用</label>
          <el-select v-model="value4" placeholder="请选择">
            <el-option
              v-for="item in options4"
              :key="item.value"
              :label="item.label"
              :value="item.value" style="width:100%;height:40px">
            </el-option>
          </el-select>
        </li>
        <li>
          <label for="">诊疗费</label>
          <el-select v-model="value5" placeholder="请选择">
            <el-option
              v-for="item in options5"
              :key="item.value"
              :label="item.label"
              :value="item.value" style="width:100%;height:40px">
            </el-option>
          </el-select>
        </li>
        <li>
          <label for="">挂号日期</label>
            <el-date-picker
              v-model="form.date"
              align="right"
              type="date"
              :picker-options="pickerOptions"
              style="width:100%;height:40px">
            </el-date-picker>
        </li>
        <li>
          <label for="">挂号员</label>
          <el-input v-model="form.operator" style="width:100%;height:40px"></el-input>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
    data() {
        return {
              introduction: false,
              loading: false,
              form: {
                oddnum:'',
                icu:'',
                reception:'',
                doctor:'',
                date:'',
                operator:'',
              },
              money :'',
              formLabelWidth: '80px',
              timer: null,
            options1: [{//科室
            value: '门诊科',
            label: '门诊科'
            }, {
            value: '儿科',
            label: '儿科'
            }, {
            value: '外科',
            label: '外科'
            }, {
            value: '内科',
            label: '内科'
            }, {
            value: '急诊科',
            label: '急诊科'
            }],
            value1: '',
            options2: [{//接诊类型
            value: '门诊',
            label: '门诊'
            }, {
            value: '普通号',
            label: '普通号'
            }, {
            value: '专家号',
            label: '专家号'
            }, {
            value: '儿童号',
            label: '儿童号'
            }, {
            value: '急诊',
            label: '急诊'
            }],
            value2: '',
            options3: [{//接诊医生
            value: '张医生',
            label: '张医生'
            }, {
            value: '李医生',
            label: '李医生'
            }, {
            value: '王医生',
            label: '王医生'
            }, {
            value: '叶医生',
            label: '叶医生'
            }, {
            value: '赵医生',
            label: '赵医生'
            }],
            value3: '',
            options4: [{//挂号费
            value: '60',
            label: '60'
            }, {
            value: '70',
            label: '70'
            }, {
            value: '80',
            label: '80'
            }, {
            value: '100',
            label: '100'
            }],
            value4: '0',
            options5: [{//诊疗费
            value: '50',
            label: '50'
            }, {
            value: '60',
            label: '60'
            }, {
            value: '80',
            label: '80'
            }, {
            value: '100',
            label: '100'
            },],
            value5: '0',
            pickerOptions: {
              disabledDate(time) {
                  return time.getTime() > Date.now();
              },
              shortcuts: [{
                  text: '今天',
                  onClick(picker) {
                  picker.$emit('pick', new Date());
                  }
              }, {
                  text: '昨天',
                  onClick(picker) {
                  const date = new Date();
                  date.setTime(date.getTime() - 3600 * 1000 * 24);
                  picker.$emit('pick', date);
                  }
              }, {
                  text: '一周前',
                  onClick(picker) {
                  const date = new Date();
                  date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
                  picker.$emit('pick', date);
                  }
              }]
            },
            value: '',
        }
    },
    methods:{
      handleClose(done) {
        if (this.loading) {
          return;
        }
        this.$confirm('确定要提交表单吗？')
          .then(_ => {
            this.loading = true;
            this.timer = setTimeout(() => {
              done();
              // 动画关闭需要一定的时间
              setTimeout(() => {
                this.loading = false;
              }, 400);
            }, 2000);
          })
          .catch(_ => {});
      },
      cancelForm() {
        this.loading = false;
        this.introduction = false;
        clearTimeout(this.timer);
      }
    }
}
</script>

<style lang="less" scoped>
#but1{
      background: #ffc71c;
      border: none;
      width: 120px;
      height: 36px;
      border-radius: 5px;
      font-weight: 600;
      font-size: 18px;
      color: #fff;
      display: flex;
      justify-content: center;
      align-items: center;
      position: absolute;
      top: 20px;
      right: 30px;
    }
    .demo-drawer__footer{
        margin: 40px 10px;
    }
 .topblock{
      // width: 1120px;
      height: 180px;
      background: #E6E7FB;
      border-radius: 5px;
      position: absolute;
      top: 80px;
      left: 30px;
      box-sizing: border-box;
      padding: 20px 10px;
        margin-right: 30px;
      ul{
        height: 100%;
        display:flex;
        justify-content: space-between;
        align-content:space-between;
        flex-wrap: wrap;
        li{
          width: 22%;
          // height: 60px;
          // margin-bottom: 20px;
          label{
            font-family: "微软雅黑";
            font-size: 12px;
            color: #5c5c65;
            margin-bottom: 4px;
            display: block;
          }
          /deep/.el-select,.el-date-picker{
            width: 100%;
            height: 40px;
          }
        }
      }
    }
</style>